package com.android.friend.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.android.friend.app.R;

public class MainActivity extends Activity implements OnClickListener {

	private Button btnWidget;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		init();
	}
	
	private void init(){
		btnWidget = (Button)findViewById(R.id.btnWidget);
		btnWidget.setOnClickListener(this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btnWidget:
			startActivity(WidgetActivity.class);
			break;

		default:
			break;
		}
	}
	
	private void startActivity(Class<?> activity){
		Intent intent = new Intent(this, activity);
		startActivity(intent);
	}

}
